﻿using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


public partial class View_Shared_EHSubmit : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //EHSubmit.IPService.IpAddressSearchWebService IPService = new EHSubmit.IPService.IpAddressSearchWebService();  //用于获取城市信息
        ////String UserIP = getIp();
        //String UserIP = "113.57.91.123";      //测试用
        //String[] IPInfo = IPService.getCountryCityByIp(UserIP);
        //String[] IPInfoValid = IPInfo[1].Split(' ');
        //String[] Temp = IPInfoValid[0].Split('省');
        //String[] Temp2 = Temp[1].Split('市');
        //String CityName = Temp2[0];
        //Context.Session["City"] = CityName;  //添加城市到Session中

        //EHSubmit.WeatherService.WeatherWebService WeatherService = new EHSubmit.WeatherService.WeatherWebService();   //用于获取天气信息
        //String[] WeatherInfo = WeatherService.getWeatherbyCityName(CityName);
        //Context.Session["Temperature"] = WeatherInfo[5];                                            //天气气温范围                                         //天气气温范围
        //Context.Session["Weather"] = WeatherInfo[6];                                                //天气概况
        //Context.Session["Wind"] = WeatherInfo[7];                                                   //风向
        //Context.Session["WeatherPhoto"] = "images/weather/a_" + WeatherInfo[8];                    //图片路径

         
    }


    private static string getIp()        //获取客户端IP
    {
        if (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null)
            return System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].Split(new char[] { ',' })[0];
        else
            return System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
    }
}
